package com.iflytek.autofly.setting.biz.secret;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.iflytek.autofly.setting.R;
import com.iflytek.autofly.setting.biz.base.BaseFragment;

/**
 * <b>Description: </b>声音设置的fragment<br/>
 * <b>Change History:</b><br/>
 * <table border="1">
 * <tr>
 * <td><b>user</b></td>
 * <td><b>date</b></td>
 * <td><b>time</b></td>
 * <td><b>reason</b></td>
 * </tr>
 * <tr>
 * <td>JunLuan@iflytek.com</td>
 * <td>2015年10月14日</td>
 * <td>上午11:34:14</td>
 * <td>创建此文件</td>
 * </tr>
 * </table>
 *
 * @author JunLuan@iflytek.com
 */
public class AdvanceSetting2Fragment extends BaseFragment {

    private View mView;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = super.onCreateView(inflater, container, savedInstanceState);
        mView = view;
        init(view);
        return view;
    }

    @Override
    public void renew() {

    }

    private void init(View v) {
        addUnit(R.layout.test_app, R.layout.test_app_sub);
        initTestApp(v);
    }

    private void initTestApp(View v) {

        TextView tunnerTestTv = (TextView) v.findViewById(R.id.advance_test_app_tuner);
        tunnerTestTv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity("com.skypine.textmode", "com.skypine.textmode.TestModeActivity");
            }
        });
        TextView btParamTv = (TextView) v.findViewById(R.id.advance_test_app_btparam);
        btParamTv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity("com.iflytek.autofly.setbtparams", "com.iflytek.autofly.setbtparams.MainActivity");
            }
        });
        TextView carDoctorTv = (TextView) v.findViewById(R.id.advance_test_app_cardoctor);
        carDoctorTv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity("com.iflytek.autofly.cardoctor", "com.iflytek.autofly.cardoctor.MainActivity");
            }
        });

    }

    private void startActivity(String pn, String cn) {
        Intent intent = new Intent();
        intent.setClassName(pn, cn);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
        getActivity().startActivity(intent);
    }

    @Override
    public void processCommandline(String cmd) {

    }

    @Override
    public String[] getCommands() {
        return new String[0];
    }


}
